+Wed Dec 24 01:12:53 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkclipboard.[hc]: Add GtkClipboardTargetReceivedFunc,
+ gtk_clipboard_request_targets() and
+ gtk_clipboard_wait_for_targets(). (#101774, Dom Lachowicz)
+
Mon Dec 22 00:40:39 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c (gtk_calendar_paint_arrow): Use
+Wed Dec 24 01:12:53 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkclipboard.[hc]: Add GtkClipboardTargetReceivedFunc,
+ gtk_clipboard_request_targets() and
+ gtk_clipboard_wait_for_targets(). (#101774, Dom Lachowicz)
+
Mon Dec 22 00:40:39 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c (gtk_calendar_paint_arrow): Use
+Wed Dec 24 01:12:53 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkclipboard.[hc]: Add GtkClipboardTargetReceivedFunc,
+ gtk_clipboard_request_targets() and
+ gtk_clipboard_wait_for_targets(). (#101774, Dom Lachowicz)
+
Mon Dec 22 00:40:39 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c (gtk_calendar_paint_arrow): Use
+Wed Dec 24 01:12:53 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkclipboard.[hc]: Add GtkClipboardTargetReceivedFunc,
+ gtk_clipboard_request_targets() and
+ gtk_clipboard_wait_for_targets(). (#101774, Dom Lachowicz)
+
Mon Dec 22 00:40:39 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c (gtk_calendar_paint_arrow): Use
+Wed Dec 24 01:12:53 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtkclipboard.[hc]: Add GtkClipboardTargetReceivedFunc,
+ gtk_clipboard_request_targets() and
+ gtk_clipboard_wait_for_targets(). (#101774, Dom Lachowicz)
+
Mon Dec 22 00:40:39 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtkcalendar.c (gtk_calendar_paint_arrow): Use
+Wed Dec 24 01:12:12 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtk-sections.txt: Add GtkClipboardTargetReceivedFunc,
+ gtk_clipboard_request_targets, gtk_clipboard_wait_for_targets.
+
+Wed Dec 24 01:11:36 2003 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/tmpl/gtkclipboard.sgml: Document GtkClipboardTargetReceivedFunc.
+
Sun Dec 21 01:58:33 2003 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add gtk_menu_shell_cancel.
GtkClipboard
GtkClipboardReceivedFunc
GtkClipboardTextReceivedFunc
+GtkClipboardTargetsReceivedFunc
GtkClipboardGetFunc
GtkClipboardClearFunc
gtk_clipboard_get
gtk_clipboard_set_text
gtk_clipboard_request_contents
gtk_clipboard_request_text
+gtk_clipboard_request_targets
gtk_clipboard_wait_for_contents
gtk_clipboard_wait_for_text
gtk_clipboard_wait_is_text_available
+gtk_clipboard_wait_for_targets
<SUBSECTION Standard>
GTK_CLIPBOARD
GTK_TYPE_CLIPBOARD
@data: the @user_data supplied to gtk_clipboard_request_text().
+<!-- ##### USER_FUNCTION GtkClipboardTargetsReceivedFunc ##### -->
+<para>
+ A function to be called when the results of gtk_clipboard_request_targets()
+ are received, or when the request fails.
+</para>
+
+@clipboard: the #GtkClipboard
+@atoms: the supported targets, as array of #GdkAtom, or %NULL
+ if retrieving the data failed.
+@n_atoms: the length of the @atoms array.
+@data: the @user_data supplied to gtk_clipboard_request_targets().
+@Since: 2.4
+
+
<!-- ##### USER_FUNCTION GtkClipboardGetFunc ##### -->
<para>
A function that will be called to provide the contents of the selection.
@user_data:
+<!-- ##### FUNCTION gtk_clipboard_request_targets ##### -->
+<para>
+
+</para>
+
+@clipboard:
+@callback:
+@user_data:
+
+
<!-- ##### FUNCTION gtk_clipboard_wait_for_contents ##### -->
<para>
</para>
@clipboard:
-@Returns: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gtk-docs.sgml" "book" "refsect2" "")
-End:
--->
+@Returns:
<!-- ##### FUNCTION gtk_clipboard_wait_is_text_available ##### -->
@Returns:
+<!-- ##### FUNCTION gtk_clipboard_wait_for_targets ##### -->
+<para>
+
+</para>
+
+@clipboard:
+@targets:
+@n_targets:
+@Returns:
+
+<!--
+Local variables:
+mode: sgml
+sgml-parent-document: ("../gtk-docs.sgml" "book" "refsect2" "")
+End:
+-->
+
typedef struct _RequestContentsInfo RequestContentsInfo;
typedef struct _RequestTextInfo RequestTextInfo;
+typedef struct _RequestTargetsInfo RequestTargetsInfo;
struct _GtkClipboard
{
gpointer user_data;
};
+struct _RequestTargetsInfo
+{
+ GtkClipboardTargetsReceivedFunc callback;
+ gpointer user_data;
+};
+
static void gtk_clipboard_class_init (GtkClipboardClass *class);
static void gtk_clipboard_finalize (GObject *object);
info);
}
+static void
+request_targets_received_func (GtkClipboard *clipboard,
+ GtkSelectionData *selection_data,
+ gpointer data)
+{
+ RequestTargetsInfo *info = data;
+ GdkAtom *targets = NULL;
+ gint n_targets = 0;
+
+ gtk_selection_data_get_targets (selection_data, &targets, &n_targets);
+
+ info->callback (clipboard, targets, n_targets, info->user_data);
+
+ g_free (info);
+ g_free (targets);
+}
+
+/**
+ * gtk_clipboard_request_targets:
+ * @clipboard: a #GtkClipboard
+ * @callback: a function to call when the targets are received,
+ * or the retrieval fails. (It will always be called
+ * one way or the other.)
+ * @user_data: user data to pass to @callback.
+ *
+ * Requests the contents of the clipboard as list of supported targets.
+ * When the list is later received, @callback will be called.
+ *
+ * The @targets parameter to @callback will contain the resulting targets if
+ * the request succeeded, or %NULL if it failed.
+ *
+ * Since: 2.4
+ **/
+void
+gtk_clipboard_request_targets (GtkClipboard *clipboard,
+ GtkClipboardTargetsReceivedFunc callback,
+ gpointer user_data)
+{
+ RequestTargetsInfo *info;
+
+ g_return_if_fail (clipboard != NULL);
+ g_return_if_fail (callback != NULL);
+
+ info = g_new (RequestTargetsInfo, 1);
+ info->callback = callback;
+ info->user_data = user_data;
+
+ gtk_clipboard_request_contents (clipboard, gdk_atom_intern ("TARGETS", FALSE),
+ request_targets_received_func,
+ info);
+}
typedef struct
{
return result;
}
+
+/**
+ * gtk_clipboard_wait_for_targets
+ * @clipboard: a #GtkClipboard
+ * @targets: location to store an array of targets. The result
+ * stored here must be freed with g_free().
+ * @n_targets: location to store number of items in @targets.
+ *
+ * Returns a list of targets that are present on the clipboard, or %NULL
+ * if there aren't any targets available. The returned list must be
+ * freed with g_free().
+ * This function waits for the data to be received using the main
+ * loop, so events, timeouts, etc, may be dispatched during the wait.
+ *
+ * Return value: %TRUE if any targets are present on the clipboard,
+ * otherwise %FALSE.
+ *
+ * Since: 2.4
+ */
+gboolean
+gtk_clipboard_wait_for_targets (GtkClipboard *clipboard,
+ GdkAtom **targets,
+ gint *n_targets)
+{
+ GtkSelectionData *data;
+ gboolean result = FALSE;
+
+ g_return_val_if_fail (clipboard != NULL, FALSE);
+
+ /* TODO: see http://bugzilla.gnome.org/show_bug.cgi?id=101774 with regard to XFIXES */
+
+ if (n_targets)
+ *n_targets = 0;
+
+ targets = NULL;
+
+ data = gtk_clipboard_wait_for_contents (clipboard, gdk_atom_intern ("TARGETS", FALSE));
+
+ if (data)
+ {
+ result = gtk_selection_data_get_targets (data, targets, n_targets);
+ gtk_selection_data_free (data);
+ }
+
+ return result;
+}
typedef void (* GtkClipboardTextReceivedFunc) (GtkClipboard *clipboard,
const gchar *text,
gpointer data);
+typedef void (* GtkClipboardTargetsReceivedFunc) (GtkClipboard *clipboard,
+ GdkAtom *atoms,
+ gint n_atoms,
+ gpointer data);
/* Should these functions have GtkClipboard *clipboard as the first argument?
* right now for ClearFunc, you may have trouble determining _which_ clipboard
void gtk_clipboard_request_text (GtkClipboard *clipboard,
GtkClipboardTextReceivedFunc callback,
gpointer user_data);
+void gtk_clipboard_request_targets (GtkClipboard *clipboard,
+ GtkClipboardTargetsReceivedFunc callback,
+ gpointer user_data);
GtkSelectionData *gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
GdkAtom target);
gboolean gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard);
+gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard,
+ GdkAtom **targets,
+ gint *n_targets);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */